; Draws the menus for upgrading, refueling, exchanging, etc.


; HL is the menu to draw

Draw_Icon_Menu:

 ld a, (hl)

 push hl
 ld e,a
 cp 0
 jr z, Draw_9x9_Menu
 
Draw_Soft_Key_Menu:

Draw_9x9_Menu:

 ld a, 16
 ld (TagX), a
 ld a, 33
 ld (TagY), a

 ld a, 6
 ld (Sprite_Width),a
 ld b, 48
 xor a
 
 ld d,h
 ld e,l
 ld ix, 0
 add ix, de
 
 ld de,37


 add ix, de

 
 ld l, 16
 call Put_Sprite_Mask


Draw_Icon_Menu_Cursor:

 ld a,2
 ld (Sprite_Width),a
 ld b,15
 ld a, (TagY)
 ld l, a
 ld a, (TagX)
 ld ix, Icon_Menu_Cursor

 

 call Put_Sprite_XOR

 ld hl, plotsscreen

 call safecopy
 pop hl
 call Draw_Item_Description
 push hl

 ld a,2
 ld (Sprite_Width),a
 ld b,15
 ld a, (TagY)
 ld l, a
 ld a, (TagX)
 ld ix, Icon_Menu_Cursor
 call Put_Sprite_XOR

Icon_Menu_Get_Key:


 B_CALL _GetCSC ;Make absolutely sure that the player has released the
		 ;key so as to avoid accidental key holds

 or a
 jr nz, Icon_Menu_Get_Key

; This next line of code is used until a problem can be solved

 B_CALL _getKey

;

 ld d, Icon_Menu
 ld e, 0
 pop hl
 call Context_Sensitive_Get_Key
 push hl

 ld a, e

 cp EndLoop
 jr z, Do_Menu_Operation

 
 jp Draw_Icon_Menu_Cursor

Do_Menu_Operation:
 pop hl
 ld b,0
 
 

 inc hl
 
 
 add hl, bc
 ld e, (hl)
 inc hl
 ld d, (hl)
 ex de, hl
 push hl
 
 ld hl, plotsscreen
 call safecopy

 pop hl
 jp (hl)

Do_Menu_Operation_Return:
 
 ret








Icon_Menu_Cursor:

	.db %11111111,%11111110
	.db %11111111,%11111110
	.db %11111111,%11111110
	.db %11111111,%11111110
	.db %11111111,%11111110
	.db %11111111,%11111110
	.db %11111111,%11111110
	.db %11111111,%11111110
	.db %11111111,%11111110
	.db %11111111,%11111110
	.db %11111111,%11111110
	.db %11111111,%11111110
	.db %11111111,%11111110
	.db %11111111,%11111110
	.db %11111111,%11111110
